package model;

import java.awt.Point;
import java.util.Random;

public class CPUIdiot extends CPU{
	protected Random CaseAuPif;

	public CPUIdiot(){
		CaseAuPif= new Random();
	}

	public Point getCoup(Grille grille, int numPlayer){
		int CaseAleat = CaseAuPif.nextInt(9);

		while(!grille.grille.get(CaseAleat).isVide()){
			CaseAleat = CaseAuPif.nextInt(9);

		}

		int ligne = CaseAleat / 3;
		int colonne = CaseAleat % 3;
		Point point = new Point(ligne, colonne);

		return point;
	}

	//Main pour test UNITAIRE
	public static void main (String arg[]){
		Grille grille = new Grille();
		CPUIdiot cpu=new CPUIdiot();
		System.out.println("grille :"+grille.grille.toString());
		for(int i =0;i< 20;i++){
				
			Point caseChoisie=cpu.getCoup(grille, 0);

			System.out.println("La case choisie est :"+caseChoisie);

		}
	}
}
